package com.xiangyueEducation.uploaderCloud.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import com.xiangyueEducation.uploaderCloud.pojo.entity.baseEntity.BaseEntityCTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @TableName chat
 */
@TableName(value ="chat")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class Chat extends BaseEntityCTime implements Serializable {

    private Long userSenderId;

    private Long userReceiverId;

    private String content;

    public Chat(Long userSenderId, Long userReceiverId, String content) {
        this.userSenderId = userSenderId;
        this.userReceiverId = userReceiverId;
        this.content = content;

    }

    public static Chat insertChat(Long userSenderId, Long userReceiverId, String content) {
        Chat chat = new Chat(userSenderId, userReceiverId, content);
        chat.setCreateTime(LocalDateTime.now());
        return chat;
    }


    private static final long serialVersionUID = 1L;

    public String toString(){
        return super.toString()+
                "\nuserSenderId:"+userSenderId+
                "\nuserReceiverId:"+userReceiverId+
                "\ncontent:"+content+
                "\n}";
    }
}